/**
 * author      : dormi330
 * date        : 2018/6/24
 * project     : mybatis
 * description : TODO
 */

package com.deep.trade.infrastructure.mybatis.order;

import com.deep.trade.domain.order.OrderSummary;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;


@Mapper
public interface OrderSummaryMapper {

    void insert(@Param("eo") OrderSummary eo);

    int updateStatus(
            // condition
            @Param("tenantCode") String tenantCode,
            @Param("orderSummaryId") String orderSummaryId,
            @Param("fromVersion") long fromVersion,
            // change field
            @Param("paidAt") Date paidAt,
            @Param("payChannel") String payChannel,
            @Param("updatedBy") String updatedBy
    );

    // ============= query ===============

    OrderSummary findOneById(
            @Param("tenantCode") String tenantCode,
            @Param("id") String id);

    List<OrderSummary> listByMember(
            @Param("tenantCode") String tenantCode,
            @Param("memberId") String memberId);

}
